package org.hyacinth.common.config;

import org.hyacinth.common.utils.MailUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

@Component
public class JavaMailSenderConfig {

    @Bean
    @ConditionalOnProperty(prefix = "spring.emil", name = "host")
    public MailUtils mailUtils(JavaMailSender javaMailSender, MailProperties mailProperties) {
        return new MailUtils(javaMailSender, mailProperties);
    }
}
